package rubik.mutators;

import java.util.ArrayList;

import rubik.ICubeSolution;
import rubik.seqs.Sequence;

public class AddRemoveMutator extends AbstractMutator {

	@Override
	protected void mutateSolution(ICubeSolution sol) {
		ArrayList<Sequence> seqs = sol.getSeqs();
		if (seqs.size() > 1) {
			if (R.nextBoolean()) {
				seqs.remove(seqs.size() - 1);
				return;
			}
		}
		seqs.add(sol.getSeqGenerator().createRandom());
	}

}
